import { baseURL } from '!/app.json'
import { request } from "./request";


/**
 * [signMonth 绑定设备
 * @param  device_sn
 */
export const userBindDeviceApi: any = (data) => {
    return request.post(`${baseURL}Weixin/Device/userBindDevice`, { data });
};


/**
 * [getUserBoundDeviceListApi 获取已经绑定的设备
 * @param  device_sn
 */
export const getUserBoundDeviceListApi: any = () => {
    return request.post(`${baseURL}Weixin/Device/getUserBoundDeviceList`);
};


/**
 * [unbindDevice 解绑设备
 * @param  device_sn
 */
export const unbindDeviceApi: any = (data) => {
    return request.post(`${baseURL}Weixin/Device/userUnbindDevice`, { data });
};
/**
 * [signMonth 获取设备类型
 */
export const getDeviceTypeList: any = () => {
    return request.post(`${baseURL}Weixin/Device/getDeviceTypeList`);
};


/**
 * [changeDeviceApi 设备替换
 * @param  device_sn
 * @param device_id
 */
export const changeDeviceApi: any = (params) => {
    return request.get(`${baseURL}Weixin/Device/changeDevice`, { params });
};


/**
 * [changeDeviceApi 设备详情
 * @param  device_sn
 */
export const getDeviceDetails: any = (data) => {
    return request.post(`${baseURL}Weixin/Device/getDeviceDetail`, { data });
};

/**
 * [checkVersion 设备版本更新监测
 * @param firmware_code
 * @param version_sn
 */
export const checkVersion: any = (data) => {
    return request.post(`${baseURL}Weixin/Upgrade/checkVersion`, { data });
};


/**
 * [checkVersion 获取硬件升级版本资源包
 * @param firmware_code
 * @param version_sn
 */
export const getDeviceUploadUrl: any = (data) => {
    return request.post(`${baseURL}Weixin/Upgrade/getUploadUrl`, { data });
};

/**
 * [updateComplete 升级成功的资源包
 * @param version_sn
 * @param armarium_device_chang
 */
export const updateComplete: any = (data) => {
    return request.post(`${baseURL}Weixin/Upgrade/updateComplete`, { data });
};


/**
 * [updateComplete 获取设备对应版本号
 * @param device_sn
 */
export const getDeviceNewFirmwareCode: any = (data) => {
    return request.post(`${baseURL}Weixin/Upgrade/getDeviceNewFirmwareCode`, { data });
};

/**
 * [deviceHistory 升级记录
 * @param page
 * @param pageSize
 * @param deviceSn
 */
export const deviceHistory: any = (data) => {
    return request.post(`${baseURL}Weixin/Upgrade/history`, { data });
};




/**
 * [answerCall 监测YY01升级是否处于批量升级
 * @param call_id
 * @param type  1、接听 2、挂断 
 */
export const answerCall: any = (data) => {
    return request.post(`${baseURL}Weixin/Rtc/answerCall`, { data });
};


/**
 * [getHandsValue 获取用户手动设置心率和体温的值
 * @param device
 * @param type  1 2、
 */
export const getHandsValue: any = (data) => {
    return request.post(`${baseURL}Weixin/user/getHandsValue`, { data });
};

/**
 * [saveHandsValue 用户手动设置心率和体温的值
 * @param device
 * @param type  1 2、
 */
export const saveHandsValue: any = (data) => {
    return request.post(`${baseURL}Weixin/user/handsValue`, { data });
};


/**
 * [getCycleData 获取疗程信息
 * @param device_sn
 * @param mobile  远程查看--对应手机号不传为空
 */
export const getCycleDataApi: any = (data) => {
    return request.post(`${baseURL}Weixin/UserData/getCycleData`, { data });
};


/**
 * [getUserLaserData 获取当天的激光数据
 * @param device_sn
 * @param mobile  远程查看对应手机号不传为空
 */
export const getUserLaserDataApi: any = (data) => {
    return request.post(`${baseURL}Weixin/UserData/getUserLaserData`, { data });
};

/**
 * [cycleDataApi 获取本月激光信息或其他月
 * @param device_sn
 * @param mobile  远程查看对应手机号不传为空
 * @param date
 */
export const cycleDataApi: any = (data) => {
    return request.post(`${baseURL}Weixin/Blood/cycleData`, { data });
};

/**
 * [courseLaserListApi 历史激光数据单日
 * @param device_sn
 * @param mobile  远程查看对应手机号不传为空
 * @param date
 * @param course_id
 */
export const courseLaserListApi: any = (data) => {
    return request.post(`${baseURL}Weixin/Blood/courseLaserList`, { data });
};


/**
 * [courseLaserListApi 获取未写入疗程列表
 * @param mobile  远程查看对应手机号不传为空
 */
export const getUserArticleListApi: any = (data) => {
    return request.post(`${baseURL}Weixin/UserArticle/getUserArticleList`, { data });
};


/**
 * [courseLaserListApi 获取未写入疗程列表
 * @param mobile  远程查看对应手机号不传为空
 * @param device_sn 
 * @param id
 */
export const writeCourse: any = (data) => {
    return request.post(`${baseURL}Weixin/UserCourse/WriteUserCourseDevice`, { data });
};

/**
 * [getUserCourseListApi 获取我写入疗程列表
 * @param mobile  远程查看对应手机号不传为空
 * @param device_sn 
 */
export const getUserCourseListApi: any = (data) => {
    return request.post(`${baseURL}Weixin/UserCourse/getUserCourseList`, { data });
};

/**
 * [getUserCourseListApi 获取服务器上的疗程参数
 * @param user_course_id  
 * @param device_sn 
 * @param mobile 
 */
export const getUserUseCourse: any = (data) => {
    return request.post(`${baseURL}Weixin/UserCourse/getUserUseCourse`, { data });
};

/**
 * [startCourse 开启新疗程
 * @param user_course_id  
 * @param device_sn 
 * @param mobile 
 * @param type 1
 */
export const startCourseApi: any = (data) => {
    return request.post(`${baseURL}Weixin/UserCourse/StartCourse`, { data });
};


/**
 * [pauseCourseApi 暂停疗程
 * @param course_id  
 * @param user_course_id
 * @param device_sn 
 * @param mobile 
 * @param type 1
 */
export const pauseCourseApi: any = (data) => {
    return request.post(`${baseURL}Weixin/UserCourse/PauseCourse`, { data });
};


/**
 * [updateUserCourseStatus 更新疗程
 * @param course_id  
 * @param user_course_id
 * @param device_sn 
 * @param mobile 
 * @param type 1
 */
export const updateUserCourseStatus: any = (data) => {
    return request.post(`${baseURL}Weixin/UserCourse/updateUserCourseStatus`, { data });
};

/**
 * [courseHistoryApi 疗程使用记录
 * @param deviceSn  
 * @param page
 * @param pageSize 
 */
export const courseHistoryApi: any = (data) => {
    return request.post(`${baseURL}Weixin/UserCourse/operateLog`, { data });
};

/**
 * [getDeviceMeasureRecord 校准值记录
 * @param deviceSn  
 */
export const getDeviceMeasureRecord: any = (data) => {
    return request.post(`${baseURL}Weixin/UserData/getDeviceMeasureRecord`, { data });
};

/**
 * [getDeviceMeasureRecord 校准值保存
 * @param device_sn  
 * @param diastole  
 * @param systolic  
 */
export const addDeviceMeasureRecord: any = (data) => {
    return request.post(`${baseURL}Weixin/UserData/addDeviceMeasureRecord`, { data });
};

/**
 * [getHeartSwitchStatus 获取自动心率开关状态
 * @param device 设备编号 
 * @param type  
 */
export const getBleSwitchApi: any = (data) => {
    return request.post(`${baseURL}Weixin/device/getSwitch`, { data });
};


/**
 * [saveUserBtnSetting 保存红色按键自定义设置
 * @param customize_phone 手机号 
 * @param type  0-管家、1-医生、2-自定义  
 */
export const saveUserBtnSetting: any = (data) => {
    return request.post(`${baseURL}Weixin/UserBtnSetting/save`, { data });
};


/**
 * [getUserBtnSetting 获取红色按键配置信息
 */
export const getUserBtnSetting: any = () => {
    return request.post(`${baseURL}Weixin/UserBtnSetting/getItem`);
};

/**
 * [deleteItem 删除红色按键配置
 */
export const delUserBtnSetting: any = () => {
    return request.post(`${baseURL}Weixin/UserBtnSetting/deleteItem`);
};

/**
 * [连接设备同步服务器信息 
 * @param device_sn
 */
export const getDeviceWriteInfo: any = (data) => {
    return request.post(`${baseURL}Weixin/UserCourse/GetDeviceWriteInfo`, { data });
};

/**
 * [上传所有数据到服务器 
 * @param device_sn
 * @param bloodPressureData 血压数据
 * @param movementData 步数
 * @param laserData 激光
 * @param HeartRateData 心率
 */
export const updateAllData: any = (data) => {
    return request.post(`${baseURL}Weixin/UserData/upload_user_data`, { data });
};

/**
 * [上传数据状态 
 * @param device_sn
 * @param type updateAll｜updateStatus
 * @param status 
 */
export const updateStatus: any = (data) => {
    return request.post(`${baseURL}Weixin/UserData/updateStatus`, { data });
};

/**
 * [连接后告诉服务器当前的版本
 * @param device_sn
 * @param energy 电量
 * @param firmware_sn 设备版本号 
 */
export const deviceGiveStatus: any = (data) => {
    return request.post(`${baseURL}Weixin/UserCourse/setCourseGiveStatus`, { data });
};


/**
 * [g更新设备别名标识
 * @param device_sn
 * @param device_alias 
 */
export const updateDeviceAlias: any = (data) => {
    return request.post(`${baseURL}Weixin/Device/UpdateDeviceAlias`, { data });
};

/**
 * [getRtcTokenApi 获取声网token
 * @param oid 订单ID
 * @param call_week 提醒日期
 * @param call_time 提醒时间
 */
export const getRtcTokenApi: any = (data: any) => {
    return request.post(`${baseURL}Weixin/Rtc/getToken`, { data });
};

/**
 * [writeOfflineCourse 写入离线疗程
 * @param  device_sn
 * @param course_type_sn
 * @param day 疗程天数
 * @param use_course_type_sn 当前设备开启的小疗程包编号

 */
export const writeOfflineCourse: any = (data) => {
    return request.post(`${baseURL}Weixin/UserCourse/writeOfflineCourse`, { data });
};

/**
 * [getUserOfflineCourse 获取离线疗程列表
 * @param  title_id
 * @param  device_sn
 */
export const getUserOfflineCourse: any = (data) => {
    return request.post(`${baseURL}Weixin/UserCourse/getUserOfflineCourse`, { data });
};


/**
 * [offlinePauseCourse 暂停离线疗程
 * @param  user_course_id
 * @param  device_sn
 */
export const offlinePauseCourse: any = (data) => {
    return request.post(`${baseURL}Weixin/UserCourse/offlinePauseCourse`, { data });
};
